﻿import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Controls.impl 2.14
import QtGraphicalEffects 1.14

Rectangle{
    id: root

    signal clicked()

    property bool isHovered: false
    property string title: ""
    property bool checked: true
    height: 40*dp
    width: parent.width
    color: isHovered ? "#F2F9FF" : "white"
    Text{
        text: title
        color: checked ? "#1677FF" : "#444444"
        anchors.verticalCenter: parent.verticalCenter
        x: 10*dp
        font.pixelSize: config.fontsize
    }CustomImage{
        x: parent.width - 34*dp; y: 3*dp
        height: 34*dp;  width: 34*dp
        source: "qrc:/picture/tick.png"
        visible: parent.visible && checked
    }MouseArea{
        anchors.fill: parent
        hoverEnabled: true
        onEntered: {
            parent.isHovered = true
        }onExited: {
            parent.isHovered = false
        }
        onReleased: {
            root.clicked()
        }
    }
}
